package com.rogo.rogobox.views
{
	import com.rogo.mvc.sub.mediator.Mediator;
	import com.rogo.rogobox.App;
	import com.rogo.rogobox.AppFacade;
	import com.rogo.rogobox.views.components.ContentBottom;
	import com.rogo.rogobox.views.components.consts.ContentMiddleConst;
	import com.rogo.rogobox.views.components.consts.PageMainConst;
	
	import flash.events.MouseEvent;
	
	public class ContentBottomMediator extends Mediator
	{
		public function ContentBottomMediator(viewComponent:Object)
		{
			super(NAME, viewComponent);
		}
		
		//--------------------------------------------------------------------------
		//
		//  Constants
		//
		//--------------------------------------------------------------------------
		
		public static const NAME:String = 'contentBottomMediator';
		
		//--------------------------------------------------------------------------
		//
		//  Variables
		//
		//--------------------------------------------------------------------------
		
		//--------------------------------------------------------------------------
		//
		//  Methods
		//
		//--------------------------------------------------------------------------
		
		private function get view():ContentBottom
		{
			return viewComponent as ContentBottom;
		}
		
		//--------------------------------------------------------------------------
		//
		//  Overridden Methods
		//
		//--------------------------------------------------------------------------
		
		override public function onRegister():void
		{
			view.createBtn.addEventListener(MouseEvent.CLICK, createBtn_clickHandler);
			view.mentionBtn.addEventListener(MouseEvent.CLICK, mentionBtn_clickHandler);
		}
		
		//--------------------------------------------------------------------------
		//
		//  Event Handlers
		//
		//--------------------------------------------------------------------------
		
		private function createBtn_clickHandler(e:MouseEvent):void
		{
			facade.sendNotification(AppFacade.SHOW_NEW_STATUS_WINDOW);
		}
		
		private function mentionBtn_clickHandler(e:MouseEvent):void
		{
			App.getInstance().mainPageDisplay = PageMainConst.DISPLAY_MENTION;
			App.getInstance().mainPageUser = App.getInstance().verifyUser;
			facade.sendNotification(AppFacade.CHANGE_CONTENT_VIEW, ContentMiddleConst.VIEW_MAIN);
			facade.sendNotification(AppFacade.DISPLAY_USER_MENTIONDS);
		}
		
	}
}